package com.atguigu.guli.service.edu.api;

import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.edu.entity.Course;
import com.atguigu.guli.service.edu.entity.Teacher;
import com.atguigu.guli.service.edu.service.CourseService;
import com.atguigu.guli.service.edu.service.TeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Miluo
 * @description 首页功能
 **/

@Api(tags = "首页管理")
@RestController
@RequestMapping("/api/edu/index")
public class ApiIndexController {
    @Autowired
    private TeacherService teacherService;

    @Autowired
    private CourseService courseService;

    @ApiOperation("热门讲师列表")
    @GetMapping
    public R selectHotTeacher(){

        List<Teacher> teacherList = teacherService.selectHotTeacher();
        List<Course> courseList = courseService.selectHotCourse();
        return R.ok().data("teacherList",teacherList).data("courseList",courseList);
    }

}
